package com.ztf.test.contants;

import lombok.Getter;

/**
 * 对象类型
 *
 * @author yjsk_lpf
 * @date 2021/07/14
 */
public class ObjectType {

	/**
	 * 借款人
	 */
	public static final String BORROWER = "1";
	/**
	 * 保证人
	 */
	public static final String WARRANT = "2";
	/**
	 * 家庭成员
	 */
	public static final String FAMILY = "3";
	/**
	 * 关联公司
	 */
	public static final String RELATE_COMPANY = "4";
	/**
	 * 出质人
	 */
	public static final String PLEDGOR = "5";

	/**
	 * 准入
	 */
	public enum Admit {

		/**
		 * 借款人
		 */
		ADMIT_BORROWER("1", "AdmitBorrower"),
		/**
		 * 保证人
		 */
		ADMIT_WARRANT("2", "AdmitWarrant"),
		/**
		 * 家庭成员
		 */
		ADMIT_FAMILY("3", "AdmitFamily"),
		/**
		 * 关联企业
		 */
		ADMIT_RELATECOMPANY("4", "AdmitRelateCompany"),
		/**
		 * 出质人
		 */
		ADMIT_PLEDGOR("5", "AdmitPledgor");

		@Getter
		private final String code;
		@Getter
		private final String value;

		Admit(String code, String value) {
			this.code = code;
			this.value = value;
		}

		public static String getObj(String objType) {
			return getV(objType).getValue();
		}

		public static Admit getV(String code) {
			for (Admit data : values()) {
				if (data.getCode().equals(code)) {
					return data;
				}
			}
			return ADMIT_BORROWER;
		}
	}

	/**
	 * 评级
	 *
	 * @author Poerseus
	 * @date 2021/07/27
	 */
	public enum Rate {
		/**
		 * 评级借款人
		 */
		RATE_BORROWER("1", "RateBorrower"),
		/**
		 * 评级保证人
		 */
		RATE_WARRANT("1", "RateWarrant");

		@Getter
		private final String code;
		@Getter
		private final String value;

		Rate(String code, String value) {
			this.code = code;
			this.value = value;
		}

		public static String getObj(String objType) {
			return getV(objType).getValue();
		}

		public static Rate getV(String code) {
			for (Rate data : values()) {
				if (data.getCode().equals(code)) {
					return data;
				}
			}
			return RATE_BORROWER;
		}
	}

	/**
	 * 额度模型对象
	 *
	 * @author Poerseus
	 * @date 2021/07/27
	 */
	public enum Limit {
		/**
		 * 额度借款人
		 */
		LIMITAMOUNT_BORROWER("1", "LimitAmountBorrower");

		@Getter
		private final String code;
		@Getter
		private final String value;

		Limit(String code, String value) {
			this.code = code;
			this.value = value;
		}

		public static String getObj(String objType) {
			return getV(objType).getValue();
		}

		public static Limit getV(String code) {
			for (Limit data : values()) {
				if (data.getCode().equals(code)) {
					return data;
				}
			}
			return LIMITAMOUNT_BORROWER;
		}
	}

	/**
	 * 额度模型对象
	 *
	 * @author Poerseus
	 * @date 2021/07/27
	 */
	public enum Price {
		/**
		 * 额度借款人
		 */
		PRICE_BORROWER("1", "PriceBorrower");

		@Getter
		private final String code;
		@Getter
		private final String value;

		Price(String code, String value) {
			this.code = code;
			this.value = value;
		}

		public static String getObj(String objType) {
			return getV(objType).getValue();
		}

		public static Price getV(String code) {
			for (Price data : values()) {
				if (data.getCode().equals(code)) {
					return data;
				}
			}
			return PRICE_BORROWER;
		}
	}
}




